//-----------------------------------------------------
// vector.h
//-----------------------------------------------------

/**
 * @file vector.h
 */

#pragma once

namespace tools {

	class CVector {

	public:

		float x;
		float y;
		float z;

	public:

		CVector() : x(0), y(0), z(0) {}
		CVector(float px, float py) : x(px), y(py), z(0) {}
		CVector(float px, float py, float pz) : x(px), y(py), z(pz) {}

		// Copy constructor
		CVector(const CVector &v) : x(v.x), y(v.y), z(v.z) {}

		~CVector() {}

		bool operator==(const CVector &other) 
		{
			return ((x == other.x) && (y == other.y) && (z == other.z));
		}

		bool operator!=(const CVector &other) 
		{
			return ((x != other.x) || (y != other.y) || (z != other.z));
		}

		CVector operator+(const CVector &other) 
		{
			return CVector((x + other.x), (y + other.y), (z + other.z));
		}

		CVector operator-(const CVector &other) 
		{
			return CVector((x - other.x), (y - other.y), (z - other.z));
		}

		CVector operator*(float e) 
		{
			return CVector(x*e, y*e, z * e);
		}

		float dotProduct(CVector v) 
		{
			return v.x * x + v.y * y + v.z *z;
		}

		float modulo() const;

		void normalize();

		static CVector getUnitVectorFromOrientation(float orientation);

	}; // class CVector
	inline float dotProduct(CVector v1, CVector v2) 
	{
		return v1.dotProduct(v2);
	}

	float deg2rad(float deg);

};  // namespace tools